<?php

namespace app\common\validate;

use think\Validate;

//分类模型验证器
class Category extends Validate
{
    protected $rule = [
        'cname' => 'require|max:15|unique:category',
        'corder' => 'number',
    ];

    protected $message = [
        'cname.require' => '分类名称必须填写',
        'cname.max' => '分类名称不能大于15个字',
        'cname.unique' => '分类名称已经存在，请重新填写',
        'corder' => '排序必须是数字',
    ];

    protected $scene = [
        'add' => ['cname', 'corder'],
        'edit' => ['cname', 'corder'],
    ];
}
